package cn.huhaoran.yaoyaolingxian.ui.CustomTreeTableImpl;

import javax.swing.tree.DefaultMutableTreeNode;

public class GitBranchNode extends DefaultMutableTreeNode {
    private String branchName;
    private String fullBranchName; // 新增字段，用于存储分支的全名称
    public String branchHash;
    private String editableName;
    private boolean selected; // 用于表示复选框的状态
    public boolean isCheckedOut; // 表示是否是当前签出的分支
    private String branchType; // 用于区分叶子节点图标的类型
    private String originUrl; // 远程仓库的 URL

    public GitBranchNode(String branchName, String fullBranchName, String branchHash, String branchType, boolean isCheckedOut, String originUrl, String editableName) {
        this.branchName = branchName;
        this.fullBranchName = fullBranchName;
        this.branchHash = branchHash;
        this.editableName = editableName; // 初始值为分支名称
        this.selected = false; // 默认未选中
        this.isCheckedOut = isCheckedOut;
        this.branchType = branchType;
        this.originUrl = originUrl;
    }

    public String getBranchName() {
        return branchName;
    }

    public String getFullBranchName() {
        return fullBranchName;
    }

    public String getBranchHash() {
        return branchHash;
    }

    public String getEditableName() {
        return editableName;
    }

    public void setEditableName(String editableName) {
        this.editableName = editableName;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public void toggleSelected() {
        this.selected = !this.selected;
    }

    public boolean isCheckedOut() {
        return isCheckedOut;
    }

    public String getBranchType() {
        return branchType;
    }

    public String getOriginUrl() {
        return originUrl;
    }

    @Override
    public String toString() {
        return branchName;
    }
}
